package xps.and.uudaijia.userclient.view.activity;

import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;

import com.jude.utils.JUtils;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import rx.Subscriber;
import xps.and.uudaijia.userclient.R;
import xps.and.uudaijia.userclient.data.baen.FKBean;
import xps.and.uudaijia.userclient.data.net.UserNetWorks;
import xps.and.uudaijia.userclient.view.base.BaseActivity;

/**
 * Created by Administrator on 2017/8/1.
 */

public class ModifyFKActivity extends BaseActivity {
    @BindView(R.id.actionbar_iv_back)
    ImageView actionbarIvBack;
    @BindView(R.id.YJ_Edit)
    EditText YJEdit;
    @BindView(R.id.bt_dopay)
    Button btDopay;

    @Override
    protected int getLayout() {
        return R.layout.activity_modifyfk;
    }

    @Override
    protected void setData() {

    }

    @Override
    protected void init() {
        ButterKnife.bind(this);
    }

    @OnClick({R.id.actionbar_iv_back, R.id.bt_dopay})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.actionbar_iv_back:
                finish();
                break;
            case R.id.bt_dopay:
                fankui();
                break;
        }
    }

    void fankui() {
        UserNetWorks.getfankui(YJEdit.getText().toString(), new Subscriber<FKBean>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {

            }

            @Override
            public void onNext(FKBean fkBean) {
                if (fkBean.getReturn_code().equals("SUCCESS")) {
                    JUtils.Toast(fkBean.getReturn_msg());
                    finish();
                } else if (fkBean.getReturn_code().equals("FAIL")) {
                    JUtils.Toast(fkBean.getReturn_msg());
                }
            }
        });
    }
}
